package com.yanxu;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetSocketAddress;

/**
 * @author 折戟沉沙铁未销
 * @version V1.0
 * @date 2025-06-05-2025
 * @Description: DatagramPackage api 相关学习
 */
public class DatagramPackage_Api {
    public static void main(String[] args) throws IOException {
        DatagramPacket datagramPacket = new DatagramPacket(
                new byte[1024],
                1024,
                new InetSocketAddress("192.168.1.222", 8888));

        datagramPacket.setData(new byte[1024]);
        datagramPacket.setLength(512);
        datagramPacket.setData(new byte[1024], 0, 1024);


        byte[] data = datagramPacket.getData();
        int length = datagramPacket.getLength();
        int offset = datagramPacket.getOffset();
    }
}